const userKey = 'userinfo'

export function setUser(data) {
  return window.sessionStorage.setItem(userKey,JSON.stringify(data))
}

export function getUser() {
  let user = null;
  try {
    let userStr = window.sessionStorage.getItem(userKey)
    user = JSON.parse(userStr)
  } catch (error) { }
  return user
}

export function clearUser(){
  return window.sessionStorage.clear()
}